package com.lrkj.web.phone;

import com.lrkj.common.core.controller.BaseController;
import com.lrkj.common.core.domain.AjaxResult;
import com.lrkj.framework.security.MiniContextUtils;
import com.lrkj.property.domain.Room;
import com.lrkj.property.service.IRoomService;
import com.lrkj.waitress.domain.CustomInfo;
import com.lrkj.waitress.service.ICustomInfoService;
import com.lrkj.workorder.domain.WorkOrderType;
import com.lrkj.workorder.service.IWorkOrderTypeService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author huxy
 * @version V1.0
 * @创建时间
 * @备注
 * @类名
 * @节点
 */
public class CommonUseBaseController extends BaseController {
    @Autowired
    private IRoomService roomService;

    @Autowired
    private ICustomInfoService customInfoService;

    @Autowired
    private IWorkOrderTypeService workOrderTypeService;

    public Room getRoom(String roomId) {
        return roomService.selectRoomById(roomId);

    }


    public CustomInfo getCustomInfo(String communityId) {
        //当前APP用户的手机号码
        String phoneNum = MiniContextUtils.getPhoneNum();
        //获取客户信息
        return customInfoService.getWxUserCustomInfo(communityId, phoneNum);
    }

    public WorkOrderType getWorkOrderTypes(String code) {
        WorkOrderType workOrderType = new WorkOrderType();
        workOrderType.setTypeCode(code);
        List<WorkOrderType> list = workOrderTypeService.selectWorkOrderTypeList(workOrderType);
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }

}

